package com.code.day09ShuZu;

public class Dome07ShuZu02 {
    public static void main(String[] args) {

        Person[] arr = new Person[3];

        arr[0] = new Person("张三", 55);
        arr[1] = new Person("李四", 33);
        arr[2] = new Person("王五", 44);

        for( int i = 0; i < arr.length-1; i++ ){
            if (arr[i].getAge()>arr[i+1].getAge()){
                Person temp = arr[i];
                arr[i] = arr[i+1];
                arr[i+1] = temp;
            }
        }
        for( int i = 0; i < arr.length; i++ ){
//        int p=arr[i].getAge();
//        String q=arr[i].getName();
//            System.out.println( q+p);
            System.out.println( arr[i].getName()+arr[i].getAge());
        }
    }
}
